import http from "./request";
import {ICommentData,IAddCommentData} from "./type"

// 根据id获取问答评论
export const getIssueCommentById = (id:string,params:ICommentData)=>{
    return http({
        url:`/api/comment/issuecomment/${id}`,
        method:"get",
        params
    })
}

// 根据id获取书籍评论
export const getBookCommentById = (id:string,params:ICommentData)=>{
    return http({
        url:`/api/comment/bookcomment/${id}`,
        method:"get",
        params
    })
}

// 新增评论
export const postAddComment = (data:IAddCommentData)=>{
    return http({
        url:"/api/comment",
        method:"post",
        data
    })
}

// 更新问答评论数
export const updateCommentNum = (id:string,data:Object)=>{
    return http({
        url:`/api/issue/${id}`,
        method:"patch",
        data
    })
}
// 更新书籍评论数
export const updateBookCommentNum = (id:string,data:Object)=>{
    return http({
        url:`/api/book/${id}`,
        method:"patch",
        data
    })
}
